#!/usr/bin/python
# -*- coding: utf-8 -*-

#This file is part of pyLot library.
#
# pyLot is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyLot is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with pyLot.  If not, see <http://www.gnu.org/licenses/>.

__author__ = u'Guillaume Baty'
__copyright__ = u"Copyright 2011-2012 (C) andheo"
__credits__ = [u'Guillaume Baty']
__license__ = "GNU Lesser General Public License"

u"""
pyLot widget interface.
  - 03-2010, Pierre Puiseux, Guillaume Baty
  
Université de Pau et des Pays de l'Adour, INRIA
"""

__all__ = [u'ITypedChooser']

from Qt4 import QtGui
from traits.api import Instance, Unicode, Python

from ..interfaces.i_widget import IWidget


class ITypedChooser(IWidget):
  u"""
  - SIGNAL dataChanged [value]: this signal is sent when chooser value changes
  """

  u"""True if input data seems correct, None if there is a doubt, 
  False if there is a problem"""
  valid = Python
  nature = Python

  def __init__(self, datum):
    pass


  def error(self, error=u'Value cannot be converted'):
    """
    Signal to user an error on input value. 
    For example changing color to red and setting an error tooltip
    """

  def doubt(self):
    """
    Signal a doubt on input value. 
    For example changing color to yellow
    """

  def ok(self):
    """
    Signal to user that all is OK. 
    For example changing color to green and setting an "OK" tooltip
    """

  def setEnabled(self, state):
    """
    Enable widget
    """

  def setDisabled(self, state):
    """
    Disable widget
    """

  def getDataWidget(self):
    u"""
    :returns: QWidget containing data (ie QLineEdit, QSpinBox, etc.)
    """

  def getPostWidgets(self):
    u"""
    Other widgets placed after label widget and data widget.
    For example a button opening a file selector or color chooser.  
    
    :returns: list of QWidget
    """

  def getPreWidgets(self):
    u"""
    Other widgets placed before data widget.
    For example, label widget.  
    
    :returns: list of QWidget
    """
    return []

  def getDatum(self):
    """
    :returns: Datum passed to constructor
    """

  def getValue(self):
    u"""
    :returns: current value
    """

  def value(self):
    u"""
    :returns: current value (alias for getValue)
    """

  def setValue(self, value):
    """
    Update chooser value
    """

  def resetDataToDefault(self):
    """
    Reset value to default
    """

if  __name__ == u"__main__":
  pass
